package view;

import controler.ControleClientes;
import dao.DaoClientes;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComboBox;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.table.DefaultTableModel;
import model.Cliente;
import model.ModeloTabela;

/**
 *
 * @author Tiago
 */
public class TelaClientes extends javax.swing.JInternalFrame {

    private static TelaClientes singleton;
    ControleClientes controleClientes = new ControleClientes();
    DaoClientes daoClientes = new DaoClientes();
    ResultSet rs;
    int flagBairros = 0 ;
    int flagEditar = 0;

    //Paterns Singleton
    public static TelaClientes getInstance() throws SQLException {
        if (singleton == null) {
            System.out.println("criando TelaClientes");
            singleton = new TelaClientes();
        } else {
            System.out.println("No duplica o obj TelaClientes");
        }
        return singleton;
    }

    /**
     * Creates new form TelaClientes
     */
    private TelaClientes() {
        initComponents();
        jPanelFormCliente.setVisible(false);

        jPanelFormCliente.setVisible(false);
        jPanelFormDependente.setVisible(false);
        btnEditarCliente.setVisible(false);
        btnExcluir.setVisible(false);


    }
    public void btnEditarExcluir(){
          
                btnEditarCliente.setVisible(true);
                btnExcluir.setVisible(true);
            
        
    }

    public void prencherTabelaClientes() throws SQLException {

      


        ResultSet rs = daoClientes.retornaCliente(jTextFieldBuscaCliente.getText(), comboProcuraCliente.getSelectedIndex());
        ResultSetMetaData rsmetadata = rs.getMetaData();
        
        //nº de colunas
        int columns = rsmetadata.getColumnCount();
        
        DefaultTableModel dtm = new DefaultTableModel();
        
        Vector colunsName = new Vector();
        Vector dataRows = new Vector();
        
        for (int i = 1; i < columns; i++) {
            colunsName.addElement(rsmetadata.getColumnName(i));
        }
        dtm.setColumnIdentifiers(colunsName);
        while(rs.next()){
            dataRows = new Vector();
            for(int j = 1 ; j < columns;j++){
                dataRows.addElement(rs.getString(j));
            }
            dtm.addRow(dataRows);
            
        } 
            this.tableclientes.setModel(dtm);
            tableclientes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            btnEditarExcluir();
          
                
       
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanelCabecalhoBusca = new javax.swing.JPanel();
        jTextFieldBuscaCliente = new javax.swing.JTextField();
        jButtonConsultaClienteNome = new javax.swing.JButton();
        comboProcuraCliente = new javax.swing.JComboBox();
        jPanelFormCliente = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        matriculaCadastroCliente = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        nomeCliente = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        cpfCliente = new javax.swing.JFormattedTextField();
        telefoneResidencial = new javax.swing.JFormattedTextField();
        jLabel7 = new javax.swing.JLabel();
        DataNascimentoCliente = new javax.swing.JFormattedTextField();
        jLabel8 = new javax.swing.JLabel();
        enderecoCliente = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        enderecoComplemento = new javax.swing.JTextField();
        salvarCliente = new javax.swing.JButton();
        jButtonCancelarCliente = new javax.swing.JButton();
        jButtonCancelarCliente1 = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        enderecoNumero = new javax.swing.JTextField();
        jComboBoxBairros = new javax.swing.JComboBox();
        jLabel16 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jPanelFormDependente = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        nomeDependente = new javax.swing.JTextField();
        dataNascimentoDependente = new javax.swing.JFormattedTextField();
        jLabel14 = new javax.swing.JLabel();
        telefoneCelularDependente = new javax.swing.JFormattedTextField();
        salvarDependente = new javax.swing.JButton();
        jButtonCancelarCliente2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jPanelCrudCliente = new javax.swing.JPanel();
        btnAdicionarCliente = new javax.swing.JButton();
        btnEditarCliente = new javax.swing.JButton();
        btnExcluir = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JSeparator();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableclientes = new javax.swing.JTable();
        jSeparator3 = new javax.swing.JSeparator();
        jSeparator1 = new javax.swing.JSeparator();

        setClosable(true);
        setIconifiable(true);
        setResizable(true);
        setTitle("Clientes");
        setToolTipText("");
        setPreferredSize(new java.awt.Dimension(1337, 700));
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jTextFieldBuscaCliente.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextFieldBuscaClienteMouseClicked(evt);
            }
        });

        jButtonConsultaClienteNome.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/lupa.png"))); // NOI18N
        jButtonConsultaClienteNome.setToolTipText("Procurar Cliente");
        jButtonConsultaClienteNome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConsultaClienteNomeActionPerformed(evt);
            }
        });

        comboProcuraCliente.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Código", "Nome" }));

        javax.swing.GroupLayout jPanelCabecalhoBuscaLayout = new javax.swing.GroupLayout(jPanelCabecalhoBusca);
        jPanelCabecalhoBusca.setLayout(jPanelCabecalhoBuscaLayout);
        jPanelCabecalhoBuscaLayout.setHorizontalGroup(
            jPanelCabecalhoBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCabecalhoBuscaLayout.createSequentialGroup()
                .addComponent(comboProcuraCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTextFieldBuscaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonConsultaClienteNome, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(44, Short.MAX_VALUE))
        );
        jPanelCabecalhoBuscaLayout.setVerticalGroup(
            jPanelCabecalhoBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCabecalhoBuscaLayout.createSequentialGroup()
                .addGroup(jPanelCabecalhoBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButtonConsultaClienteNome, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanelCabecalhoBuscaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(comboProcuraCliente, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jTextFieldBuscaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 17, Short.MAX_VALUE))
        );

        getContentPane().add(jPanelCabecalhoBusca, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 550, 50));

        jPanelFormCliente.setEnabled(false);

        jLabel2.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel2.setText("Código");

        matriculaCadastroCliente.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        matriculaCadastroCliente.setEnabled(false);

        jLabel3.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel3.setText("Nome:");

        nomeCliente.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        nomeCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nomeClienteActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel4.setText("CPF:");

        try {
            cpfCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        cpfCliente.setToolTipText("Digite somente numeros.");

        try {
            telefoneResidencial.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        jLabel7.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel7.setText("Data de Nascimento:");

        try {
            DataNascimentoCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        jLabel8.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel8.setText("Endereço:");

        enderecoCliente.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N

        jLabel9.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel9.setText("Complemento:");

        enderecoComplemento.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N

        salvarCliente.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        salvarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Salvar.png"))); // NOI18N
        salvarCliente.setText("Salvar");
        salvarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salvarClienteActionPerformed(evt);
            }
        });

        jButtonCancelarCliente.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        jButtonCancelarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Cancela.png"))); // NOI18N
        jButtonCancelarCliente.setText("Cancelar");
        jButtonCancelarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCancelarClienteActionPerformed(evt);
            }
        });

        jButtonCancelarCliente1.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        jButtonCancelarCliente1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Dependente.png"))); // NOI18N
        jButtonCancelarCliente1.setText("Dependente");
        jButtonCancelarCliente1.setDoubleBuffered(true);
        jButtonCancelarCliente1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCancelarCliente1ActionPerformed(evt);
            }
        });

        jLabel15.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel15.setText("Nº:");

        jLabel10.setText("Bairro:");

        jComboBoxBairros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxBairrosActionPerformed(evt);
            }
        });

        jLabel16.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel16.setText("Telefone Residencial:");

        jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/1Cliente.png"))); // NOI18N
        jLabel11.setText("Clientes");

        javax.swing.GroupLayout jPanelFormClienteLayout = new javax.swing.GroupLayout(jPanelFormCliente);
        jPanelFormCliente.setLayout(jPanelFormClienteLayout);
        jPanelFormClienteLayout.setHorizontalGroup(
            jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                                .addComponent(salvarCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButtonCancelarCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButtonCancelarCliente1))
                            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel8)
                                    .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                                        .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(2, 2, 2)
                                        .addComponent(enderecoNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                                        .addComponent(jLabel9)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(enderecoComplemento)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jComboBoxBairros, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(enderecoCliente)))
                            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(matriculaCadastroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(nomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 432, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                                .addComponent(jLabel16)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(telefoneResidencial, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cpfCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(DataNascimentoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(339, 339, 339)
                        .addComponent(jLabel10))
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(178, 178, 178))
        );
        jPanelFormClienteLayout.setVerticalGroup(
            jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                        .addGap(2, 2, 2)
                        .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(matriculaCadastroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addComponent(nomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                        .addGap(9, 9, 9)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cpfCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(DataNascimentoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(15, 15, 15)
                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel16)
                    .addComponent(telefoneResidencial, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(19, 19, 19)
                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(enderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addGap(4, 4, 4)
                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(enderecoComplemento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(enderecoNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15)
                    .addComponent(jComboBoxBairros, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(32, 32, 32)
                .addGroup(jPanelFormClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salvarCliente)
                    .addComponent(jButtonCancelarCliente)
                    .addComponent(jButtonCancelarCliente1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanelFormClienteLayout.createSequentialGroup()
                .addGap(187, 187, 187)
                .addComponent(jLabel10)
                .addContainerGap(139, Short.MAX_VALUE))
        );

        getContentPane().add(jPanelFormCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 10, 620, 340));

        jLabel12.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel12.setText("Nome Dependende:");

        jLabel13.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel13.setText("Data de Nascimento:");

        try {
            dataNascimentoDependente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        jLabel14.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel14.setText("Tefone Celular:");

        try {
            telefoneCelularDependente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        salvarDependente.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        salvarDependente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Salvar.png"))); // NOI18N
        salvarDependente.setText("Salvar");
        salvarDependente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salvarDependenteActionPerformed(evt);
            }
        });

        jButtonCancelarCliente2.setFont(new java.awt.Font("Trebuchet MS", 0, 12)); // NOI18N
        jButtonCancelarCliente2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Cancela.png"))); // NOI18N
        jButtonCancelarCliente2.setText("Cancelar");
        jButtonCancelarCliente2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonCancelarCliente2ActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Dependente.png"))); // NOI18N
        jLabel1.setText("Dependentes");

        javax.swing.GroupLayout jPanelFormDependenteLayout = new javax.swing.GroupLayout(jPanelFormDependente);
        jPanelFormDependente.setLayout(jPanelFormDependenteLayout);
        jPanelFormDependenteLayout.setHorizontalGroup(
            jPanelFormDependenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFormDependenteLayout.createSequentialGroup()
                .addGroup(jPanelFormDependenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(jPanelFormDependenteLayout.createSequentialGroup()
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(nomeDependente, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelFormDependenteLayout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dataNascimentoDependente, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(telefoneCelularDependente, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanelFormDependenteLayout.createSequentialGroup()
                        .addComponent(salvarDependente)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonCancelarCliente2)))
                .addContainerGap(99, Short.MAX_VALUE))
        );
        jPanelFormDependenteLayout.setVerticalGroup(
            jPanelFormDependenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelFormDependenteLayout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelFormDependenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(nomeDependente))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelFormDependenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dataNascimentoDependente, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14)
                    .addComponent(telefoneCelularDependente, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelFormDependenteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salvarDependente)
                    .addComponent(jButtonCancelarCliente2))
                .addGap(51, 51, 51))
        );

        getContentPane().add(jPanelFormDependente, new org.netbeans.lib.awtextra.AbsoluteConstraints(630, 360, 610, 180));

        btnAdicionarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Adicionar.png"))); // NOI18N
        btnAdicionarCliente.setText("Adicionar");
        btnAdicionarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAdicionarClienteActionPerformed(evt);
            }
        });

        btnEditarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Editar.png"))); // NOI18N
        btnEditarCliente.setText("Editar");
        btnEditarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEditarClienteActionPerformed(evt);
            }
        });

        btnExcluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Excluir.png"))); // NOI18N
        btnExcluir.setText("Excluir");
        btnExcluir.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/img/Excluir.png"))); // NOI18N
        btnExcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExcluirActionPerformed(evt);
            }
        });

        tableclientes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        tableclientes.setGridColor(new java.awt.Color(51, 153, 255));
        jScrollPane1.setViewportView(tableclientes);

        javax.swing.GroupLayout jPanelCrudClienteLayout = new javax.swing.GroupLayout(jPanelCrudCliente);
        jPanelCrudCliente.setLayout(jPanelCrudClienteLayout);
        jPanelCrudClienteLayout.setHorizontalGroup(
            jPanelCrudClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCrudClienteLayout.createSequentialGroup()
                .addComponent(btnAdicionarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnEditarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanelCrudClienteLayout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 558, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 1, Short.MAX_VALUE))
        );
        jPanelCrudClienteLayout.setVerticalGroup(
            jPanelCrudClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelCrudClienteLayout.createSequentialGroup()
                .addGroup(jPanelCrudClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanelCrudClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btnAdicionarCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btnEditarCliente))
                    .addComponent(btnExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelCrudClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelCrudClienteLayout.createSequentialGroup()
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)))
        );

        getContentPane().add(jPanelCrudCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 70, 560, 460));

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);
        getContentPane().add(jSeparator3, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, -30, 10, 580));
        getContentPane().add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 350, 630, 10));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonConsultaClienteNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonConsultaClienteNomeActionPerformed
        try {
            this.prencherTabelaClientes();
        } catch (SQLException ex) {
            Logger.getLogger(TelaClientes.class.getName()).log(Level.SEVERE, null, ex);
        }



    }//GEN-LAST:event_jButtonConsultaClienteNomeActionPerformed

    private void jTextFieldBuscaClienteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextFieldBuscaClienteMouseClicked

    }//GEN-LAST:event_jTextFieldBuscaClienteMouseClicked
    
    public void preecheMatriculacliente() {
        try {
            String proximaMatricula;
            proximaMatricula = Integer.toString(controleClientes.retornaUltimoCliente());
            this.matriculaCadastroCliente.setText(proximaMatricula);
        } catch (SQLException ex) {
            Logger.getLogger(TelaClientes.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void preecheComboBairros() {

        jComboBoxBairros.addItem("Selecione o Bairro");
        ResultSet rs = controleClientes.retornaBairros();
        try {
            while (rs.next()) {
                ArrayList bairros =new ArrayList();
                bairros.add(rs.getString("PkintIdBairro"));
                bairros.add(rs.getString("txtNomeBairro"));
                
                jComboBoxBairros.addItem(bairros);
            
            }
        } catch (SQLException ex) {
            Logger.getLogger(TelaClientes.class.getName()).log(Level.SEVERE, null, ex);
        }
        flagBairros = 1;
    }

    private boolean validaAdicionaCliente() {
        int flag = 0;
        String validacao = "Campos de Preenchimento Obrigatório";

        if (this.nomeCliente.getText().isEmpty()) {
            validacao = validacao + "\n* Campo Nome deve ser Preenchido";
            flag = 1;

        }
        if (this.cpfCliente.getValue() == null) {
            validacao = validacao + "\n* Campo Cpf deve ser Preenchido";
            flag = 1;

        }
        if (this.DataNascimentoCliente.getValue() == null) {
            validacao = validacao + "\n*Campo Data Nascimento deve ser preenchido";
            flag = 1;

        }
        if (this.telefoneResidencial.getValue() == null) {
            validacao = validacao + "\n*Campo Telefone Residencial deve ser preenchido";
            flag = 1;
        }
        if (this.enderecoCliente.getText().isEmpty()) {
            validacao = validacao + "\n*Campo Endereço deve ser preenchido";
            flag = 1;
        }
        if (this.enderecoNumero.getText().isEmpty()) {
            validacao = validacao + "\n*Campo Nº Endereço deve ser preenchido";
            flag = 1;
        }

        if (jComboBoxBairros.getSelectedIndex() <= 0) {
            validacao = validacao + "\n*Selecione o Bairro!";
            flag = 1;
        }

        if (flag == 1) {

           JOptionPane.showMessageDialog(this, validacao);

            return false;
        } else {
            return true;
        }


    }

    private void jComboBoxBairrosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxBairrosActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBoxBairrosActionPerformed

    private void jButtonCancelarCliente1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarCliente1ActionPerformed
        jPanelFormDependente.setVisible(true);
    }//GEN-LAST:event_jButtonCancelarCliente1ActionPerformed

    private void jButtonCancelarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarClienteActionPerformed
        jPanelFormDependente.setVisible(false);
        limpaCamposClietes();
    }//GEN-LAST:event_jButtonCancelarClienteActionPerformed
    private void limpaCamposClietes() {
        enderecoComplemento.setText(null);
        enderecoCliente.setText(null);
        nomeCliente.setText(null);
        cpfCliente.setValue(null);
        DataNascimentoCliente.setValue(null);
        telefoneResidencial.setValue(null);
        enderecoNumero.setText(null);
        matriculaCadastroCliente.setText(null);


    }

    private void salvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salvarClienteActionPerformed
        if (validaAdicionaCliente()==true && flagEditar == 0) {

        String txtCpfCliente = this.cpfCliente.getValue().toString();
        String txtEnderecoCliente = this.enderecoCliente.getText();
        String txtNomeCliente = this.nomeCliente.getText();
        String dataNascimentoCliente = this.DataNascimentoCliente.getValue().toString();
        
        String txtTelefoneCliente = this.telefoneResidencial.getValue().toString();
        String txtEnderecoComplemento = this.enderecoComplemento.getText();

        String txtEnderecoNum = this.enderecoNumero.getText();
        int Fk_intIdBairro = this.jComboBoxBairros.getSelectedIndex();

        controleClientes.adicionarCliente(  txtCpfCliente, txtEnderecoCliente, txtNomeCliente, dataNascimentoCliente, txtTelefoneCliente, txtEnderecoComplemento, txtEnderecoNum,Fk_intIdBairro);
        limpaCamposClietes();
        JOptionPane.showMessageDialog(this, "Cliente adicionado com sucesso!");
            try {
                this.prencherTabelaClientes();
            } catch (SQLException ex) {
                Logger.getLogger(TelaClientes.class.getName()).log(Level.SEVERE, null, ex);
            }
    
        }if(flagEditar==1){
   
            //if(controleClientes.updateCliente(controleClientes.retornaCliente(this.matriculaCadastroCliente.getText()))==1){
                JOptionPane.showMessageDialog(this, "Cliente Edita com Sucesso!");}

        
    }//GEN-LAST:event_salvarClienteActionPerformed
        
        
    
    private boolean validaDependente(){
        int flagDependente = 0;
        String validacaoDependente = "Campos de preenchimento obrigatório";
        
        if(this.nomeDependente.getText().isEmpty()){
           flagDependente = 1;
           validacaoDependente = validacaoDependente + "\n *O campo Nome do Dependente é obrigatório!";
                       
        }
         if(this.dataNascimentoDependente.getValue()==null){
           flagDependente = 1;
           validacaoDependente = validacaoDependente + "\n *O campo Data de Nascimento do Dependente é obrigatório!";
                       
        }if(flagDependente == 1){
            JOptionPane.showMessageDialog(this, validacaoDependente);
            return false;
        }else{ return true;}
    }
    
    
    private void nomeClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nomeClienteActionPerformed
    }//GEN-LAST:event_nomeClienteActionPerformed

    private void salvarDependenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salvarDependenteActionPerformed
        validaDependente();
    }//GEN-LAST:event_salvarDependenteActionPerformed

    private void jButtonCancelarCliente2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelarCliente2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonCancelarCliente2ActionPerformed

    private void btnAdicionarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdicionarClienteActionPerformed
        jPanelFormCliente.setVisible(true);
        if(flagBairros == 0){
            preecheComboBairros();
        }
        try {
            int ultimaMatricula = controleClientes.retornaUltimoCliente();
            this.matriculaCadastroCliente.setText(Integer.toString(ultimaMatricula)  );
        } catch (SQLException ex) {
            Logger.getLogger(TelaClientes.class.getName()).log(Level.SEVERE, null, ex);
        }
        

    }//GEN-LAST:event_btnAdicionarClienteActionPerformed

    private void btnEditarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarClienteActionPerformed
       String idClienteSelecionado = tableclientes.getValueAt(tableclientes.getSelectedRow(), 0).toString();
       flagEditar = 1;
       if(flagBairros == 0) { preecheComboBairros();}
       flagBairros =1;
        try {
           
            
            
             ResultSet rsClienteEditado = controleClientes.retornaCliente(Integer.parseInt((idClienteSelecionado)));
             preencheclienteEditado(rsClienteEditado);
             String nomeClienteEdita  = rsClienteEditado.getString("txtNomeCliente");
             System.out.println(nomeClienteEdita);
             controleClientes.updateCliente(Integer.parseInt(idClienteSelecionado));
             //limpaCamposClietes();
             
        } catch (SQLException ex) {
            Logger.getLogger(TelaClientes.class.getName()).log(Level.SEVERE, null, ex);
        }
       
       
       
    }//GEN-LAST:event_btnEditarClienteActionPerformed

    private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
     String idCliente = tableclientes.getValueAt(tableclientes.getSelectedRow(), 0).toString(); 
     
            if(daoClientes.excluirCliente(Integer.parseInt(idCliente))==1){
                JOptionPane.showMessageDialog(this, "Cliente Excluido Com sucesso!");
                try {
                    prencherTabelaClientes();
                } catch (SQLException ex) {
                    Logger.getLogger(TelaFilmes.class.getName()).log(Level.SEVERE, null, ex);
                }
            }else{
                JOptionPane.showMessageDialog(this, "Erro ao Excluir Cliente.");
                
            }
            
     
    }//GEN-LAST:event_btnExcluirActionPerformed
private void preencheclienteEditado(ResultSet rs) throws SQLException{
    
    while(rs.next()){
  
    String cpf = rs.getString("txtCpfCliente");
    String txtEnderecoCliente = rs.getString("txtenderecoCliente");
    String txtNomeCliente = rs.getString("txtNomeCliente");
    String dataNascimentoCliente = rs.getString("Data Convertida");
    String txtTelefoneCliente = rs.getString("txtTelefoneCliente");
    String txtEnderecoComplemento = rs.getString("txtEnderecoComplemento");
    String txtEnderecoNum = rs.getString("txtEnderecoNum");

    String codCliente = Integer.toString(rs.getInt("Código"));

    jPanelFormCliente.setVisible(true);
    this.matriculaCadastroCliente.setText(codCliente);
    this.nomeCliente.setText(txtNomeCliente);
    this.enderecoCliente.setText(txtEnderecoCliente);
    this.cpfCliente.setValue(cpf);
    this.DataNascimentoCliente.setValue(dataNascimentoCliente);
    this.telefoneResidencial.setValue(txtTelefoneCliente);
    this.enderecoNumero.setText(txtEnderecoNum);
    this.enderecoComplemento.setText(txtEnderecoComplemento);
    
    
    }


}
    
   
    


    
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JFormattedTextField DataNascimentoCliente;
    private javax.swing.JButton btnAdicionarCliente;
    private javax.swing.JButton btnEditarCliente;
    private javax.swing.JButton btnExcluir;
    private javax.swing.JComboBox comboProcuraCliente;
    private javax.swing.JFormattedTextField cpfCliente;
    private javax.swing.JFormattedTextField dataNascimentoDependente;
    private javax.swing.JTextField enderecoCliente;
    private javax.swing.JTextField enderecoComplemento;
    private javax.swing.JTextField enderecoNumero;
    private javax.swing.JButton jButtonCancelarCliente;
    private javax.swing.JButton jButtonCancelarCliente1;
    private javax.swing.JButton jButtonCancelarCliente2;
    private javax.swing.JButton jButtonConsultaClienteNome;
    private javax.swing.JComboBox jComboBoxBairros;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanelCabecalhoBusca;
    private javax.swing.JPanel jPanelCrudCliente;
    private javax.swing.JPanel jPanelFormCliente;
    private javax.swing.JPanel jPanelFormDependente;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JTextField jTextFieldBuscaCliente;
    private javax.swing.JTextField matriculaCadastroCliente;
    private javax.swing.JTextField nomeCliente;
    private javax.swing.JTextField nomeDependente;
    private javax.swing.JButton salvarCliente;
    private javax.swing.JButton salvarDependente;
    private javax.swing.JTable tableclientes;
    private javax.swing.JFormattedTextField telefoneCelularDependente;
    private javax.swing.JFormattedTextField telefoneResidencial;
    // End of variables declaration//GEN-END:variables

    public JTextField getEnderecoNumero() {
        return enderecoNumero;
    }

    public JFormattedTextField getDataNascimentoCliente() {
        return DataNascimentoCliente;
    }

    public JFormattedTextField getDataNascimentoDependente() {
        return dataNascimentoDependente;
    }


    public JFormattedTextField getTelefoneCelularDependente() {
        return telefoneCelularDependente;
    }

    public void setTelefoneCelularDependente(JFormattedTextField telefoneCelularDependente) {
        this.telefoneCelularDependente = telefoneCelularDependente;
    }

    public JFormattedTextField getTelefoneResidencial() {
        return telefoneResidencial;
    }

    public void setTelefoneResidencial(JFormattedTextField telefoneResidencial) {
        this.telefoneResidencial = telefoneResidencial;
    }

    public JTextField getEnderecoComplemento() {
        return enderecoComplemento;
    }

    public void setEnderecoComplemento(JTextField enderecoComplemento) {
        this.enderecoComplemento = enderecoComplemento;
    }

    public JFormattedTextField getcpfCliente() {
        return cpfCliente;
    }

    public void setcpfCliente(JFormattedTextField jFormattedTextFieldCpfCliente) {
        this.cpfCliente = jFormattedTextFieldCpfCliente;
    }

    public JTextField getNomeCliente() {
        return nomeCliente;
    }

    public void setNomeCliente(JTextField nomeCliente) {
        this.nomeCliente = nomeCliente;
    }

    public JTextField getEnderecoCliente() {
        return enderecoCliente;
    }

    public void setEnderecoCliente(JTextField enderecoCliente) {
        this.enderecoCliente = enderecoCliente;
    }
}
